/* global token */

$(function(){
     var token=sessionStorage.getItem("token");
     var yyy=sessionStorage["login_name"];
     var pagesize="10";
     var p=1;
     var i=1;
     get_phone(p);
     $('.more').click(function(){
         i++;
         get_phone(i);
     })
  function get_phone(i){
      var d={};
      d.token=token;
      d.method="get_photos";
      d.pagesize=pagesize;
      d.p=i;
     $.ajax({  
            type:'POST',
            url:"http://www.rice.com/app/api/h5_access",
            data:d,
            dataType:"json",
            success:function(result){
               
                console.log(result);
                if(result.status == 1){
                     var data=result.data.list;
                    var str=$(".share-t").html();
                    for(var i in data){
                        str+='<div class="am-u-sm-6" style="padding: 10px 10px 0 10px" onclick="javascript:sessionStorage.setItem(\'phoneid\','+data[i].id+');location.href=\'http://www.rice.com/home/Register/gide/phone/'+yyy+'/id/'+data[i].id+'\';"><img src="'+data[i].url+'" width="100%"/></div>';
                    }
                   $(".share-t").append(str);
                }else if(result.status== 2){
                        alert(data.message);
                        window.location.href="login.html";	
                }else{
                        alert(data.message);
                }
            }  
        });
}
})